#include<bits/stdc++.h>
using namespace std;

int read(){
	int a;
	scanf("%d",&a);
	return a;
}

int n,maxn,tot;
int a[100005],b[100005],ans;
signed main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	n = read();
	for(int i = 1;i <= n;i++){
		int cnt;
		cnt = read();
		a[cnt]++;
		maxn = max(maxn,cnt);
	}
	int cnt = 0;
	for(int i = 1;i <= maxn;i++){
		if(a[i] > 0){
			b[++cnt] = a[i];
		}
	}
	tot = b[1];
	
	for(int i = 2;i <= cnt;i++){
//		cout << b[i] << " "<<tot << " " <<ans << endl;
		if(b[i] >= tot){
			ans += tot;
			tot = b[i];
		}
		else{
			ans += b[i];
		}
	}
/*	for(int i = 2;i <= cnt;i++){
		if(b[i] > b[i - 1])
			ans += b[i - 1];
		else ans += b[i];
	}
*/
	cout << n - ans << endl;
	return 0;
}
